<template>
  <ul class="product_list">
    <li v-for="item in goodsList" :key="item.id" @click="goToDetails(item.id)">
      <img v-lazy="item.list_pic_url" />
      <div>{{ item.name }}</div>
      <section>{{ item.retail_price | filterMoney }}</section>
    </li>
  </ul>
</template>
 
<script>
export default {
  props: ["goodsList"],
  data() {
    return {};
  },
  methods: {
    goToDetails(id) {
      this.$router.push("/details/" + id);
      // 强行刷新页面 (报错) async await
      // window.location.reload();
      // this.$router.go(0);
    },
  },
};
</script>
 
<style lang = "less" scoped>
.product_list {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  padding: 10px;
  box-sizing: border-box;
  width: 100%;
  li {
    width: 49%;
    background: #fff;
    text-align: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    img {
      width: 100%;
      display: block;
    }
    section {
      margin-top: 5px;
      color: darkred;
    }
  }
}
</style>